package Test;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

//求最长无重复子字符串
public class Main06 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        int maxLentgh = findMaxLength(str);
        System.out.println(maxLentgh);

    }

    public static int findMaxLength(String str) {
        int n = str.length();
        int maxLength = 0;
        Map<Character, Integer> map = new HashMap<Character, Integer>();
        for (int j = 0, i = 0; j < n; j++) {
            if (map.containsKey(str.charAt(j))) {
                i = Math.max(map.get(str.charAt(j)) + 1, i);
            }
            maxLength = Math.max(maxLength, j - i + 1);
            map.put(str.charAt(j), j);
        }
        return maxLength;
    }
}
//IP地址
/*
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        ArrayList<String> list = new ArrayList<>();
        search(4, 0, list, str, str.length());
        System.out.println(list.size());
    }

    public static void search(int count, int index, List list, String str, int len) {
        String temp = "";
        if ((count == 0 && index < len) || (count > 0 && index == len)) {
            return;
        }
        if (count == 0 && index == len) {
            list.add(temp);
            return;
        }
        int value = 0;
        boolean flag = true;
        while (index < len && flag) {
            if (value == 0 && str.charAt(index) == '0') {
                flag = false;
            }
            value = value * 10 + str.charAt(index) - '0';
            index++;
            if (value < 256) {
                String record = "";
                if (count == 1) {
                    record = temp + Integer.toString(value);
                } else {
                    record = temp + Integer.toString(value) + '.';
                }
                search(count - 1, index, list, str, len);
            }
        }
    }
}
*/